home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swaga_c.zip / ANSI.SWG / 0019_ANSI Music.pas < prev    next >
Pascal/Delphi Source File  |  1993-11-02  |  4KB  |  104 lines

  1. {
  2. JACK DYBCZAK
  3.                                ANSI MUSIC
  4.  
  5. It's Really simple to create this music. Hopefully many more will start
  6. using those codes inside online games etc.
  7.  
  8. Small examples:
  9.  
  10.  O3     Sets octave 3
  11.  T120   Sets tempo to 120 (default)
  12.  
  13. You can use several statements on each line. Could it be more simple.
  14. It's exactly the same command as the BASIC command called PLAY from
  15. IBM BASIC or GW-BASIC and all those.
  16.  
  17.          MUSIC:
  18.  
  19.           Syntax: ESC[MF T120 O2C8D8E8F8G8 (All lines must end With ASCII 14)
  20.  
  21.           Music Strings in the BASIC Play format are supported.
  22.           Multiple Strings per line may be entered.
  23.  
  24.           Music Strings should begin With the Characters "<esc>[M"
  25.           where <esc> is a True ESC Character (DEC 27, Hex 1B).
  26.           Please refer to your BASIC manual For information on the
  27.           BASIC Play commands.  The following are all valid for
  28.           beginning a Music String in SMILE: MF, MB, MN, ML, MS, M .
  29.           Although MB (Music Background) is valid, True backgroud
  30.           music is not supported.
  31.  
  32.           Music Strings should end With the musical note Character
  33.           (DEC 14, Hex 0E, CTRL-N).  if this Character is missing,
  34.           SMILE will look For the next ESC Character or the
  35.           end-of-line marker to terminate the music String.  This
  36.           option was added to try and catch as many incorrectly
  37.           formated music Strings as possible.  However, for
  38.           compatiblity With other viewers, I suggest you always end
  39.           your music Strings With CTRL-N (DEC 14)
  40.  
  41.           Sound:
  42.           ( Thanks to Julie Ibarra, author of ANSIPLAY For this idea )
  43.  
  44.           Syntax:
  45.           ESC[MF Freq; Duration; Cycles; CycleDelay;Variation (DEC14)
  46.  
  47.           Custom Sounds are supported in SMILE by using a Sound CODE
  48.           similar to that found in BASIC and the Program ANSIPLAY.
  49.           However, the Sound generator in SMILE differs from the
  50.           Sound command in BASIC.  Therefore, different frequency
  51.           values must be used to produce the musical notes.  These
  52.           are listed somewhere down the page.
  53.  
  54.           The Sound statement must begin and end in the same manner
  55.           discussed above For a normal music String.  The Sound CODE
  56.           consists of the following parameters serparated by a
  57.           semicolon (;) :
  58.  
  59.           FREQ     : Frequency of note to be played.  The affective
  60.                      range of frequencies is 0 to 7904.
  61.                      (0..65535)
  62.  
  63.           DURATION : Time, in milliseconds, the note should be played.
  64.                      (0..65535)
  65.  
  66.           CYCLES   : Number of times to Repeat Frequency/Duration.
  67.                      (0..65535)
  68.  
  69.           Delay    : Time, in milliseconds, between cycles.
  70.                      (0..65535)
  71.  
  72.           VarIATION: Frequency value is changed by this number for
  73.                      each CYCLE the note is played.
  74.                      (-65535..65535)
  75.  
  76.           (NOTE: 1 second = 1000 milliseconds)
  77.  
  78.           Press ESC to Exit a DURATION or Delay action.  You may
  79.           have to press ESC a couple of times to completely Exit
  80.           a Sound sequence.
  81.  
  82.           Sound CODE Musical Note Frequency Values (7 Octives):
  83.  
  84.             C    C#   D    D#   E    F    F#   G    G#   A    A#   B
  85.  
  86.             65   69   73   78   82   87   92   98  104  110  116  123
  87.            131  139  147  156  165  175  185  196  208  220  233  247
  88.            262  278  294  312  330  350  370  392  416  440  466  494
  89.            524  556  588  624  660  700  740  784  832  880  932  988
  90.           1048 1112 1176 1248 1320 1400 1480 1568 1664 1760 1864 1976
  91.           2096 2224 2352 2496 2640 2800 2960 3136 3328 3520 3728 3952
  92.           4192 4448 4704 4992 5280 5600 5920 6272 6656 7040 7456 7904
  93.  
  94.           One advantage of the Sound CODE is the ability to place a
  95.           PAUSE in your ANSI screens Without having to use a
  96.           multitude of ESC[s codes.  Just use a Sound CODE With the
  97.           Delay set very high to get a pause.  For example,
  98.  
  99.           ESC[MF ;;;60000
  100.  
  101.           would pause your ANSI Screen For 60 seconds, or Until a key
  102.           is pressed when viewing it With SMILE.  Remember, these
  103.           Sound CODES are not supported by bulletin boards...(yet)!
  104.